#!/bin/bash

trap "echo 'Sorry! I have trapped Ctrl-C'" SIGINT
trap "echo byebye" EXIT

echo This is a test program
count=1
while [ $count -le 10 ]; do
    echo "Loop #$count"
    sleep 5
    count=$[ $count + 1 ]
done

# remove a trap
trap - EXIT

